<?php

/**
 * Empresa form base class.
 *
 * @method Empresa getObject() Returns the current form's model object
 *
 * @package    Sanitas
 * @subpackage form
 * @author     Jose Antonio Sánchez Bedoya
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEmpresaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'cif'              => new sfWidgetFormInputText(),
      'nombre'           => new sfWidgetFormInputText(),
      'direccion_linea1' => new sfWidgetFormInputText(),
      'direccion_linea2' => new sfWidgetFormInputText(),
      'cp'               => new sfWidgetFormInputText(),
      'poblacion'        => new sfWidgetFormInputText(),
      'provincia'        => new sfWidgetFormInputText(),
      'telefono'         => new sfWidgetFormInputText(),
      'fax'              => new sfWidgetFormInputText(),
      'web'              => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormInputText(),
      'logo'             => new sfWidgetFormInputText(),
      'descripcion'      => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'validated_at'     => new sfWidgetFormDateTime(),
      'is_validated'     => new sfWidgetFormInputCheckbox(),
      'removed_at'       => new sfWidgetFormDateTime(),
      'remove_it'        => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'cif'              => new sfValidatorString(array('max_length' => 15)),
      'nombre'           => new sfValidatorString(array('max_length' => 255)),
      'direccion_linea1' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'direccion_linea2' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'cp'               => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'poblacion'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'provincia'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telefono'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'fax'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'web'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'email'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'logo'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'descripcion'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
      'validated_at'     => new sfValidatorDateTime(array('required' => false)),
      'is_validated'     => new sfValidatorBoolean(array('required' => false)),
      'removed_at'       => new sfValidatorDateTime(array('required' => false)),
      'remove_it'        => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('empresa[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Empresa';
  }

}
